﻿@{
    ViewBag.Title = "Administrar";
}

@{
      string[] names = Enum.GetNames(typeof(LocalElectrodomesticos.Controllers.Categoria ));    
     
}

<style>table thead.tabla2
{
	font:10px arial;
	background-color: grey;
	color: White;
}
</style>

<h2>Administrar</h2>

<a href="/Local/Listar">Ver lista de Productos</a>
<br />
<a href="/Local/Administrar">Administrar Productos</a>
<br />
<a href="/Local/Carrito">Carrito de Compras</a>

<form action="/Local/Agregar" method="post">
    <label>
        <span>Nombre:</span>
        <input name="nombre" type="text" />
    </label>
    <label>
        <span>Marca:</span>
        <input name="marca" type="text" />
    </label>
    <label>
        <span>Precio:</span>
        <input name="precio" type="number" />
    </label>
    <label>
        <span>Categoria:</span>
        <select name="categoria">
        @for (int i = 0; i<names.Length; i++) 
        {
            var s = names[i];
            <option value="@i">@s</option>
        }
    </label>
    <input type="submit" />
</form>




<table style="border: 1px solid black;">
<thead class="tabla2">
<tr>
    <th>Nombre</th>
    <th>Marca</th>
    <th>Precio</th>
    <th>Categoria</th>
    <th>Operaciones</th>
</tr>
</thead>
    
@{int total = 0;
<tbody>
    
@{
    int co = 0;

    foreach (var i in Model)
    {
    <tr>
    <td width="350" style="border: 1px solid black ;">
                 @i.nombre
    </td>
  
    
    <td width="100" style="border: 1px solid black ;">@i.marca</td>
    <td width="100" style="border: 1px solid black ;">@i.precio</td> 
    <td width="100" style="border: 1px solid black ;">@i.categoria</td>
    <td width="100" style="border: 1px solid black ;"><a href="@Url.Action("Borrar")?pos=@co">Borrar Item</a>
    <a href="@Url.Action("Modificar")?pos=@co">Modificar Item</a></td>
    </tr>
     
                                     co++;
    }
}
 
</tbody>

<tfoot>
    <tr>

    </tr>
</tfoot>
}
</table>